fix(catalog): preserve metadata location when using snapshots=refs#4724
Open
ArnavBalyan wants to merge 1 commit into
Open
fix(catalog): preserve metadata location when using snapshots=refs#4724ArnavBalyan wants to merge 1 commit into
ArnavBalyan wants to merge 1 commit into
Conversation
Member
Author
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Fixes loss of metadata-location in Iceberg REST LoadTableResponse when filtering snapshots to refs, and adds a regression test to ensure the location is preserved.
Changes:
- Preserve
metadata-locationwhen returning a filteredsnapshots=refsresponse. - Expose
filterResponseToSnapshotsfor testing via@VisibleForTesting. - Add a new test that validates snapshot filtering keeps the original metadata location.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java | Rebuilds filtered metadata while preserving metadata location; makes the helper accessible for tests. |
| runtime/service/src/test/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandlerTest.java | Adds regression coverage ensuring metadata-location is retained after filtering to refs. |
Comment on lines
+1403
to
1405
| @VisibleForTesting | ||
| @NonNull LoadTableResponse filterResponseToSnapshots( | ||
| LoadTableResponse loadTableResponse, String snapshots) { |
Comment on lines
+1419
to
+1423
| TableMetadata filteredMetadataWithLocation = | ||
| TableMetadata.buildFrom(filteredMetadata) | ||
| .withMetadataLocation(metadata.metadataFileLocation()) | ||
| .discardChanges() | ||
| .build(); |
Comment on lines
+309
to
+310
| @SuppressWarnings("resource") | ||
| void filterResponseToSnapshotsRefsPreservesMetadataLocation() throws Exception { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
CHANGELOG.md(if needed)site/content/in-dev/unreleased(if needed)